package cn.gson.boot.model.dao;

import cn.gson.boot.model.pojos.Target;
import cn.gson.boot.model.pojos.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.math.BigDecimal;

public interface TargetDao extends CrudRepository<Target,Integer> {
    //统计图销售员（员工）的目标统计
    @Query(nativeQuery = true,value = "select sum(target_mb) from target_ where emp_id=?1  and target_cjsj like ?2")
    public BigDecimal empMbYj(User user,String time);

    //统计图销售员（员工）的业绩统计
    @Query(nativeQuery = true,value = " select sum(h.hk_money) as aaa from huikuan h LEFT JOIN dingdan d on h.dd_id = d.dd_id  LEFT JOIN user_ u on u.emp_name = d.dd_syz  where u.emp_id = ?1  and h.hk_time like ?2")
    public BigDecimal empMbYj2(User user,String time);

    //统计图按年月份查询的目标金额统计
    @Query(nativeQuery = true,value = "select  sum(target_mb) from target_ where target_cjsj like?1")
    public BigDecimal Mb(String nian);

    //统计图按年月份查询的业绩金额统计
    @Query(nativeQuery = true,value = "select  sum(hk_money) from huikuan where hk_time like?1 ")
    public BigDecimal Yj(String nian);



}

